﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
using Volo.Abp;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using Bridge.Shared.Enums.Wms;

namespace Stock
{
    [Comment("库存流水表")]
    [Table("t_flowstock")]
    public class FlowStock : AuditedAggregateRoot<Guid>, ISoftDelete, IMultiTenant
    {
        public FlowStock(Guid keyId)

        {
            this.Id = keyId;
        }

        public FlowStock()
        {

        }

        [Comment("单据编号")]
        [MaxLength(100)]
        public string VoucherCode { get; set; }

        [Comment("关联单据明细ID")]
        public Guid RealationId { get; set; }

        [Comment("部门编码id")]
        public Guid DeptId { get; set; }

        public Guid DeptName { get; set; }

        [Comment("产品编码")]
        [MaxLength(100)]
        public string ProductCode { get; set; }

        [Comment("产品名称")]
        [MaxLength(300)]
        public string ProductName { get; set; }
  
        [Comment("产品批号")]
        [MaxLength(200)]
        public string ProductBatch { get; set; }

        [Comment("出入库数量（入库正数 出库负数）")]
        public decimal OutInCount { get; set; }
  
        [Comment("单价")]
        [Column(TypeName = "decimal(18,4)")]
        public decimal OutInPrice { get; set; }

        [Comment("产品大类")]
        [MaxLength(100)]
        public string ProductClassName { get; set; }

 
        [Comment("生产日期")]
        public DateTime? ProductDate { get; set; }

        [Comment("有效期")]
        public DateTime? ExpiryDate { get; set; }

        [Comment("货位")]
        [MaxLength(100)]
        public string ShelfCode { get; set; }

        [Comment("批次跟踪码（供应商编码+入库单号+行号）")]
        [MaxLength(100)]
        public string TrackCode { get; set; }

        [Comment("入库单号")]
        [MaxLength(100)]
        public string InStockVoucherCode { get; set; }
  
        [Comment("入库数量")]
        [Column(TypeName = "decimal(18,4)")]
        public decimal InStockCount { get; set; }

        [Comment(" 出入库标识：1-入库  2-出库 3-出入库")]
        public OutInFlagEnum OutInFlag { get; set; }

        [Comment("出入库类型：1-采购入库 2-采购退货  3-仓库出库 4-科室退库 5-科室消耗 6-科室消退 7-库房调拨 8-库房盘点 9-定数打包  10-定数拆包  11-入库冲销  12-手术套包组包  13-手术套包拆包")]
        public OutInTypeEnum OutInType { get; set; }

        [Comment("产品小类名称")]
        [MaxLength(100)]
        public string ProductMinClass { get; set; }

        [Comment("供应商Id")]
        public Guid SupplierId { get; set; }


        [Comment("批次库存ID")]
        public Guid StockId { get; set; }


        [Comment("操作前库存")]
        [Column(TypeName = "decimal(18,4)")]
        public decimal BeforeStockCount { get; set; }

        [Comment("操作过后库存")]
        [Column(TypeName = "decimal(18,4)")]
        public decimal AfterStockCount { get; set; }

        [Comment("出入库时间")]
        public DateTime OutInTime { get; set; }

        [Comment("套包编码或定数包条码")]
        [MaxLength(100)]
        public string BarCode { get; set; }

        public bool IsDeleted { get; set; } = false;

        public Guid? TenantId { get; set; }
    }
}
